TreeGrid Cells Tutorial
2. Combos and Checkboxes
Attributes and types for selectable popup lists and for clickable checkboxes
-
Enum
type shows combo to select one or more values from popup list, similarly to SELECT html tag. To select more values, set Range='1'. Enum items can contain any HTML code.
The list of values is defined by Enum attribute. The cell value can be direct value(s) from the list or the index(es) of the value in list or a key(s), if defined list of keys by EnumKeys attribute.
The Enum and EnumKeys lists can be creates also on demand by custom JavaScript in event OnGetEnum and OnGetEnumKeys. Enum, opposite to defaults, cannot load dynamically from server side.
The popup menu can show simple list of the defined items, or list of items with checkboxes for Range.
Or you can define custom menu by EnumMenu, here you can use all advanced TreeGrid menu features like collapsing levels or submenus.
The Enum lists in one row can be related, the list in one cell is chosen according to values in other cell(s). Set relation by Related and Clear attributes.
Relation is for example Continent -> Country -> State -> Region -> City, it means that for selected continent Europe will be listed only european countries in the country combo.
-
Select
type is simple combo similar to Enum type, with different look. It is shortcut to Type='Html' CanEdit='0' Button='Defaults'.
It shows list of items to choose one or more of them to the cell. The items can contain any HTML code. The menu supports all TreeGrid menu features like collapsible levels or submenus.
It is used mostly in Space rows as simple combo.
-
Button
Defaults
shows right side button, with popup list to choose one or more items for the cell. It can be used for any cell Type.
The cell can be still editable and is possible to input different values than in the list - it differs from Enum type.
It is set by Button="Defaults" and the list is defined by Defaults attribute. The defaults menu supports all TreeGrid menu features like collapsible levels or submenus.
In the list can be used various keywords starting by * to show values from other cells - from this column, other column, from only some rows, the most frequent values and so on. It can be done especially in Filter cell.
The automatic values can be also grouped to submenus according alphabet, when the list is too large.
It is possible to download dynamically the list from server side (DefaultsServer='1') or to create it on demand by JavaScript in API event OnGetDefaults.
-
Attribute
Suggest
shows a list during typing with items suggested for actual input (like Google suggest input). It can be used for every editable cell type. Can be combined also with Button Defaults.
The complete list is defined by the Suggest attribute and grid automatically updates the list during typing to show only items that contain (or start by) the typed text.
There are many options set by SuggestType - when the list will be shown, case-sensitivity, accepting custom items (typed, not selected), automatic completion and so on.
Suggest is also compatible with Range cells, suggests values for individual parts in the cell range. The Suggest list also supports keywords with * to fill it automatically from other cells like in Defaults list.
It is possible to download dynamically the list from server side (SuggestServer='1') for actually typed value or to create it on demand by JavaScript in API event, the whole by OnGetSuggest or for actually typed value by OnSuggest.
-
Bool
type shows one checkbox in cell. It has two states, checked and unchecked. It can have three states (checked, unchecked, empty) if set CanEmpty="1".
The Bool cells can be grouped in column by BoolGroup and in row by Radio attribute. Only one Bool cell inside the same group can be checked, checking another unchecks the previous one.
The groups can also permit or restrict all checkboxes unchecked by Uncheck attribute. There are more icons for the checkboxes chosen by BoolIcon.
-
Radio
type shows more checkboxes in one cell. The checkboxes are grouped, to permit only one checkbox in the cell checked. If set RadioUncheck="1", permits also all checkboxes to be unchecked.
The Radio can be used in Range cell, here it checks / unchecks the checkboxes independently, more checkboxes can be checked in one cell. There are more icons for the checkboxes chosen by RadioIcon.
The Radio lists in one row can be related, similarly to Enum type, the options in one cell are chosen according to values in other cell(s). Set relation by Related and Clear attributes.
It is even possible to related Radio and Enum types together. Related Radio can be used also in Range cells, the dependent Radio will merge options for all buttons checked in the source Radio cell.